/*
 * 
 *
 *
 */
package com.hboxs.asl.service;

import com.hboxs.asl.Page;
import com.hboxs.asl.Pageable;
import com.hboxs.asl.entity.Letter;
import com.hboxs.asl.entity.Member;

import java.util.List;

/**
 * Service - 私信
 */
public interface LetterService extends BaseService<Letter, Long> {

    /**
     * 保存私信
     * @param sender
     * @param receiver
     * @param content
     */
    void generateLetter(Member sender, Member receiver, String content);

    /**
     * 回复私信
     * @param sender
     * @param receiver
     * @param content
     * @param letterId
     */
    void replyLetter(Member sender, Member receiver, String content, Long letterId);

    /**
     * 获取我的私信列表
     * @return
     */
    List<Letter> findLetterPage(Member member);

    List<Letter> findLetterDetailList(Letter letter);

    /**
     * list转换为page
     * @param pageable
     * @param letterList
     * @return
     */
    Page<Letter> findPageLetter(Pageable pageable, List<Letter> letterList);

    Page<Letter> findPageLetters(Pageable pageable);


    Page<Letter> findPageLetterByTime(Pageable pageable, Letter letter);

    /**
     * sender是否给receiver发送过信息
     * @param sender
     * @param receiver
     * @return
     */
    Letter ifHasSend(Member sender, Member receiver);

    /**
     * 获取未读私信数量
     * @param receiver
     * @param letterId
     * @return
     */
    long hasNotReadLetters(Member receiver, Long letterId);
}
